package interfaz;

import java.awt.BorderLayout;
import java.awt.Cursor;
import java.awt.FlowLayout;
import java.awt.Toolkit;

import javax.swing.GroupLayout;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JLayeredPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.GroupLayout.Alignment;
import javax.swing.border.EmptyBorder;
import java.awt.Font;

public class Mensaje extends JDialog {

	private final JPanel contentPanel = new JPanel();

	/**
	 * Launch the application.
	 */
	public static void main(String[] args) {
		try {
			Mensaje dialog = new Mensaje("Hola");
			dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
			dialog.setVisible(true);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	/**
	 * Create the dialog.
	 */
	public Mensaje(String msg) {
		setResizable(false);
		setIconImage(Toolkit.getDefaultToolkit().getImage(Mensaje.class.getResource("/assets/warning-sign2.png")));
		setBounds(400, 200, 502, 235);
		
		JLayeredPane layeredPane = new JLayeredPane();
		GroupLayout groupLayout = new GroupLayout(getContentPane());
		groupLayout.setHorizontalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addGroup(groupLayout.createSequentialGroup()
					.addComponent(layeredPane, GroupLayout.PREFERRED_SIZE, 495, GroupLayout.PREFERRED_SIZE)
					.addContainerGap(24, Short.MAX_VALUE))
		);
		groupLayout.setVerticalGroup(
			groupLayout.createParallelGroup(Alignment.LEADING)
				.addComponent(layeredPane, GroupLayout.DEFAULT_SIZE, 207, Short.MAX_VALUE)
		);
		
		JLabel lblWarning = new JLabel("");
		lblWarning.setIcon(new ImageIcon(Mensaje.class.getResource("/assets/Iconos/Ok.-1.png")));
		lblWarning.setBounds(10, 37, 118, 122);
		layeredPane.add(lblWarning);
		
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setBounds(154, 37, 311, 122);
		layeredPane.add(scrollPane);
		
		JTextArea textError = new JTextArea(msg);
		scrollPane.setViewportView(textError);
		textError.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		textError.setEditable(false);
		
		JLabel lblMensajeDeAlerta = new JLabel("Mensaje");
		lblMensajeDeAlerta.setFont(new Font("Tahoma", Font.BOLD, 15));
		lblMensajeDeAlerta.setBounds(266, 11, 76, 14);
		layeredPane.add(lblMensajeDeAlerta);
		getContentPane().setLayout(groupLayout);}

}
